<template>
  <div>
    <my-header-1 top="0px" position="fixed"></my-header-1>
    <my-header-2 top="50px" position="fixed"></my-header-2>
    <div class="top-bar">
      <div class="box1">
        <span @click="changeCity">{{ city }}</span>
        <div class="triangle-down"></div>
      </div>
      <div class="box2">
        <div @click="left = '20px'">
          <router-link to="/home/reying">热映</router-link>
        </div>
        <div @click="left = '80px'">
          <router-link to="/home/yingyuan">影院</router-link>
        </div>
        <div @click="left = '139px'">
          <router-link to="/home/daiying">待映</router-link>
        </div>
        <div @click="left = '210px'">
          <router-link to="/home/jingdian">经典电影</router-link>
        </div>
        <div :style="{ left }"></div>
      </div>
      <div class="box3">
        <img src="../../assets/img/search-red.png" alt="" />
      </div>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
import MyHeader1 from "../../components/MyHeader1.vue";
import MyHeader2 from "../../components/MyHeader2.vue";
export default {
  name: "MovieView",
  components: {
    MyHeader1,
    MyHeader2,
  },
  data() {
    return {
      left: ".5333rem",
    };
  },
  methods: {
    changeCity() {
      console.log(this.$route);
      this.$router.push("/city");
    },
  },
  computed: {
    city() {
      return this.$store.state.cityObj.name;
    },
  },
};
</script>

<style scoped>
.top-bar a.router-link-exact-active {
  line-height: 38px;
  display: inline-block;
  font-size: 17px;
  font-weight: 700;
  color: #333;
}
.top-bar {
  width: 10rem;
  position: fixed;
  top: 110px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f0f0f0;
  background: #fff;
  z-index: 9;
}

.top-bar .box1 {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-left: 10px;
}

.top-bar span {
  font-size: 15px;
}

.top-bar .box2 {
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: relative;
}

.top-bar .box2 div {
  font-size: 15px;
  padding: 0px 14px;
}

.top-bar .box3 {
  width: 1.0667rem;
  height: 100%;
  display: flex;
  align-items: center;
  margin-right: 10px;
}

.top-bar .box3 img {
  width: 20px;
  height: 20px;
}

.top-bar .box2 .nav-ac {
  font-size: 17px;
  font-weight: 700;
}

.triangle-down {
  height: 0;
  width: 0;
  border: 5px solid #b0b0b0;
  border-color: #b0b0b0 transparent transparent transparent;
  margin-top: 0.2667rem;
}
.top-bar .box2 div:last-child {
  width: 20px;
  height: 3px;
  position: absolute;
  bottom: 0;
  background: #f03d37;
  z-index: 10;
  padding: 0px 0px;
  transition: 0.7s;
}
</style>